﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="InstructorEditScheduleScreen.aspx.cs" Inherits="METU_CMT.InstructorEditScheduleScreen" %>

<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager runat="server" ID="dfjkhslkjdf">
    </asp:ScriptManager>
    <script type="text/JavaScript">
        function validateHhMm(inputField) {
            var isValid = /^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$/.test(inputField.value);

            if (isValid) {
                inputField.style.backgroundColor = '#bfa';
            } else {
                inputField.style.backgroundColor = '#fba';
            }

            return isValid;
        }
    </script>
    <asp:Table ID="Table1" runat="server" Width="100%" HorizontalAlign="Center" CssClass="chp-grid"
        Style="font-size: 15px; margin-top: 50px;">
        <asp:TableRow ID="TableRow1" runat="server" Width="100%" HorizontalAlign="Left">
            <asp:TableCell ID="TableCell2" runat="server">
                <asp:GridView runat="server" Width="100%" ID="dtgSchedule" AutoGenerateColumns="false"
                    ShowHeaderWhenEmpty="true" OnRowCancelingEdit="OnDtgScheduleCancellingEdit" OnRowEditing="OnDtgScheduleRowEditing"
                    OnRowCommand="OnDtgScheduleRowCommand" OnRowUpdating="OnDtgScheduleRowUpdating"
                    OnRowDeleting="OnDtgScheduleRowDeleting" CssClass="chp-grid">
                    <Columns>
                        <asp:TemplateField HeaderText="Due Date">
                            <ItemTemplate>
                                <asp:Label ID="lblDueDate" Text='<%# Bind("DueDate") %>' runat="server"></asp:Label>
                                <asp:HiddenField ID="hfId" Value='<%# Bind("EventId") %>' runat="server"></asp:HiddenField>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtDueDateEdit" Text='<%# Bind("DueDateDayFormat") %>' runat="server"
                                    CssClass="chp-text-field"></asp:TextBox>
                                <asp:MaskedEditExtender ID="MaskedEditExtender25" runat="server" TargetControlID="txtDueDateEdit"
                                    Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                                    OnInvalidCssClass="MaskedEditError" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"
                                    ErrorTooltipEnabled="True" />
                                <asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender25"
                                    ControlToValidate="txtDueDateEdit" EmptyValueMessage="Date is required" InvalidValueMessage="Date is invalid"
                                    IsValidEmpty="False" TooltipMessage="Input a Date" ValidationGroup="MKE1">
                                </asp:MaskedEditValidator>
                                <asp:TextBox ID="txtDueTimeEdit" Text='<%# Bind("DueDateTimeFormat") %>' runat="server"
                                    CssClass="chp-text-field" onchange="validateHhMm(this);"></asp:TextBox>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator123123" runat="server" ValidationExpression="^([0-1]?[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$"
                                ControlToValidate="txtDueTimeEdit" ErrorMessage="Invalid Time Format(HH:MM)" ValidationGroup="MKE1"></asp:RegularExpressionValidator>
                                <asp:HiddenField ID="hfId" Value='<%# Bind("EventId") %>' runat="server"></asp:HiddenField>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Description">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" Text='<%# Bind("Description") %>' runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtDescriptionEdit" Text='<%# Bind("Description") %>' runat="server"
                                    CssClass="chp-text-field"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtDescriptionEdit"
                                    Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE1">* Description is required!</asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="SubmissionExist">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSubmissionExist" Checked='<%# Bind("SubmissionExist") %>' runat="server"
                                    Enabled="false"></asp:CheckBox>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="chkSubmissionExistEdit" Checked='<%# Bind("SubmissionExist") %>'
                                    runat="server" CssClass="chp-checkbox-radio-2"></asp:CheckBox>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Action">
                            <ItemTemplate>
                                <asp:LinkButton runat="server" ID="lnkBtnDelete" Text="Delete" CommandName="Delete"></asp:LinkButton>
                                <asp:LinkButton runat="server" ID="lnkBtnEdit" Text="Edit" CommandName="Edit"></asp:LinkButton>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <p>
                                    <asp:LinkButton ID="lbtnUpdate" runat="server" CausesValidation="True" CommandName="Update"
                                        Text="Save" ValidationGroup="MKE1"></asp:LinkButton>
                                </p>
                                <p>
                                    <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Cancel"></asp:LinkButton>
                                </p>
                            </EditItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell ID="TableCell1" runat="server">
                <asp:Table ID="Table20" runat="server" Width="100%" HorizontalAlign="Center" CssClass="chp-grid">
                    <asp:TableRow ID="TableRow20" runat="server">
                        <asp:TableCell ID="TableCell4" runat="server" Width="150">Due Date</asp:TableCell>
                        <asp:TableCell ID="TableCell21" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtDate" CssClass="chp-text-field"></asp:TextBox>
                            <asp:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="txtDate"
                                Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                                OnInvalidCssClass="MaskedEditError" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"
                                ErrorTooltipEnabled="True" />   
                            <asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender5"
                                ControlToValidate="txtDate" EmptyValueMessage="Date is required" InvalidValueMessage="Date is invalid"
                                IsValidEmpty="False" TooltipMessage="Input a Date" ValidationGroup="MKE">
                            </asp:MaskedEditValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow11" runat="server">
                        <asp:TableCell ID="TableCell12" runat="server" Width="150">Due Time</asp:TableCell>
                        <asp:TableCell ID="TableCell14" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtTime" CssClass="chp-text-field" OnChange="validateHhMm(this);"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator12312we3" runat="server" ValidationExpression="^([0-1]?[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$"
                                ControlToValidate="txtTime" ErrorMessage="Invalid Time Format(HH:MM)" ValidationGroup="MKE"></asp:RegularExpressionValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow12" runat="server">
                        <asp:TableCell ID="TableCell15" runat="server" Width="150">Description</asp:TableCell>
                        <asp:TableCell ID="TableCell16" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtDescription" CssClass="chp-text-field"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtDescription"
                                Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE">* Description is required!</asp:RequiredFieldValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow13" runat="server">
                        <asp:TableCell ID="TableCell17" runat="server" Width="150">Submission</asp:TableCell>
                        <asp:TableCell ID="TableCell18" runat="server" HorizontalAlign="Left">
                            <asp:CheckBox runat="server" ID="chkSubmission" CssClass="chp-checkbox-radio-2" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow3" runat="server">
                        <asp:TableCell ID="TableCell5" runat="server" HorizontalAlign="Left" ColumnSpan="2">
                            <asp:Button runat="server" ID="btnAdd" OnClick="OnBtnAddClicked" Text="Add" ValidationGroup="MKE"
                                CssClass="chp-button-red" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow ID="TableRow2" runat="server">
            <asp:TableCell ID="TableCell3" runat="server" HorizontalAlign="Left" ColumnSpan="2">
                <asp:LinkButton runat="server" ID="lnkBtnAssignTeams" OnClick="OnLnkBtnAssignTeams"
                    Text="Assign Review Teams"></asp:LinkButton>
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
</asp:Content>
